package com.lele.ui;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class UI_v1 extends JFrame implements ActionListener {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JLabel lbProject_root;
	private JLabel lbProject_name;
	private JLabel lbPackage_url;
	private JLabel lbEntityClass;
	private JLabel lbDB_name;
	protected JTextField tfProject_root;
	protected JTextField tfProject_name;
	protected JTextField tfPackage_url;
	protected JTextField tfEntityClass;
	protected JTextField tfDB_name;
	
	private JButton btnOK;
	private JButton btnExit;
	private JButton btnCreatePackage;

	public UI_v1() {

		JPanel p1 = new JPanel();
		lbProject_root = new JLabel("项目目录:");
		tfProject_root = new JTextField(12);
		tfProject_root.setText("E:\\Workspaces\\");
		p1.add(lbProject_root);
		p1.add(tfProject_root);
		
		
		JPanel p2 = new JPanel();
		lbProject_name = new JLabel("项目名称:");
		tfProject_name = new JTextField(12);
		p2.add(lbProject_name);
		p2.add(tfProject_name);

		JPanel p3 = new JPanel();
		lbPackage_url = new JLabel("包　　名:");
		tfPackage_url = new JTextField(12);
		p3.add(lbPackage_url);
		p3.add(tfPackage_url);

		JPanel p4 = new JPanel();
		lbEntityClass = new JLabel("实体名称:");
		tfEntityClass = new JTextField(12);
		p4.add(lbEntityClass);
		p4.add(tfEntityClass);
		
		JPanel p5 = new JPanel();
		lbDB_name = new JLabel("　数据库:");
		tfDB_name = new JTextField(12);
		p5.add(lbDB_name);
		p5.add(tfDB_name);
		
		JPanel p6 = new JPanel();
		btnCreatePackage = new JButton("生成包");
		btnCreatePackage.addActionListener(this);
		btnOK = new JButton("生成文件");
		btnOK.addActionListener(this);
		btnExit = new JButton("取消");
		btnExit.addActionListener(this);
		p6.add(btnCreatePackage);
		p6.add(btnOK);
		p6.add(btnExit);
		
		this.setLayout(new GridLayout(0,1));
		this.add(p1);
		this.add(p2);
		this.add(p3);
		this.add(p4);
		this.add(p5);
		this.add(p6, BorderLayout.SOUTH);

		this.setLocation(100, 300);
		this.setSize(330, 230);
		this.setTitle("SSH代码生成器 PowerBy:赜 v1.0");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
		this.setResizable(false);
	}

	public void actionPerformed(ActionEvent e) {
		//new ActionPerformed(e);
	}

}
